package org.example.model;

import org.example.model.Enum.ExamType;
import org.example.model.PoJo.ExamData;
import org.example.model.PoJo.OneData;

import java.util.*;

public class ExamDatabase{


    //================ 语文题库（2种） ================
    private static final ExamData chineseExam = new ExamData(UUID.randomUUID().toString(), ExamType.CHINESE, Arrays.asList(
            new OneData("'春风又绿江南岸'出自哪位诗人的作品？", "王安石"),
            new OneData("《红楼梦》中'机关算尽太聪明'形容的是谁？", "王熙凤"),
            new OneData("'唐宋八大家'中唐代的两位代表人物是？", "韩愈、柳宗元"),
            new OneData("翻译：学而不思则罔", "只学习不思考就会迷惑而无所得"),
            new OneData("'破釜沉舟'典故出自哪场战役？", "巨鹿之战"),
            new OneData("《阿Q正传》的作者是？", "鲁迅"),
            new OneData("'但愿人长久'的下一句是？", "千里共婵娟"),
            new OneData("'醉翁之意不在酒'中的醉翁指谁？", "欧阳修"),
            new OneData("《史记》的体例属于？", "纪传体通史"),
            new OneData("'落红不是无情物'的下一句是？", "化作春泥更护花")
    ));

    private static final ExamData chineseExam2 = new ExamData(UUID.randomUUID().toString(), ExamType.CHINESE, Arrays.asList(
            new OneData("'人生自古谁无死'下一句是？", "留取丹心照汗青"),
            new OneData("《西游记》中唐僧的原型人物是？", "玄奘"),
            new OneData("'君子成人之美'出自哪部典籍？", "《论语》"),
            new OneData("'沉舟侧畔千帆过'的下一句是？", "病树前头万木春"),
            new OneData("'三顾茅庐'请的是哪位历史人物？", "诸葛亮"),
            new OneData("《窦娥冤》的作者是？", "关汉卿"),
            new OneData("'海内存知己'的下一句是？", "天涯若比邻"),
            new OneData("'问君能有几多愁'的下一句是？", "恰似一江春水向东流"),
            new OneData("《资治通鉴》的编纂体例是？", "编年体"),
            new OneData("'天下兴亡'的下一句是？", "匹夫有责")
    ));

    //================ 数学题库（2种） ================
    private static final ExamData mathExam = new ExamData(UUID.randomUUID().toString(), ExamType.MATH, Arrays.asList(
            new OneData("计算：(12+5)×3-8÷2", "47"),
            new OneData("求三角形面积（底6cm，高4cm）", "12cm²"),
            new OneData("解不等式：3x-5 > 10", "x > 5"),
            new OneData("等差数列首项3，公差4，求第10项", "39"),
            new OneData("计算圆的周长（r=5cm）", "31.4cm"),
            new OneData("二次函数y=x²-4x+3的顶点坐标是？", "(2,-1)"),
            new OneData("求对数：log₂8", "3"),
            new OneData("抛硬币三次，两次正面的概率是多少？", "3/8"),
            new OneData("解方程组：{x+y=5; 2x-y=1}", "x=2,y=3"),
            new OneData("正方体体积公式是？", "边长的三次方")
    ));

    private static final ExamData mathExam2 = new ExamData(UUID.randomUUID().toString(), ExamType.MATH, Arrays.asList(
            new OneData("求导数：y=3x²+2x+1", "y'=6x+2"), // 新增题
            new OneData("解方程：2x + 5 = 15", "x=5"),
            new OneData("计算梯形面积（上底3cm,下底5cm,高4cm）", "16cm²"),
            new OneData("求复数：(3+2i)+(1-4i)", "4-2i"),
            new OneData("三角函数sin30°的值是？", "0.5"),
            new OneData("矩阵[[1,2],[3,4]]的行列式值", "-2"),
            new OneData("求极限：lim(x→0) sinx/x", "1"),
            new OneData("二进制数1010转十进制是？", "10"),
            new OneData("计算：∫2x dx从0到1", "1"),
            new OneData("排列组合：C(5,2)的值", "10")
    ));

    //================ 英语题库（2种） ================
    private static final ExamData englishExam = new ExamData(UUID.randomUUID().toString(), ExamType.ENGLISH, Arrays.asList(
            new OneData("'图书馆'的英文翻译是？", "library"),
            new OneData("将'I have a book.'改为疑问句", "Do you have a book?"),
            new OneData("'Beautiful'的比较级是？", "more beautiful"),
            new OneData("'She __ (go) to Paris last year.'正确时态填空", "went"),
            new OneData("'Elephant'的正确复数形式是？", "elephants"),
            new OneData("反义词：'expensive'", "cheap"),
            new OneData("翻译：Practice makes perfect.", "熟能生巧"),
            new OneData("'Cannot'的缩写形式是？", "can't"),
            new OneData("'How old are you?'的恰当回答", "I'm [数字] years old."),
            new OneData("'They are __ students.'填入冠词", "the")
    ));

    private static final ExamData englishExam2 = new ExamData(UUID.randomUUID().toString(), ExamType.ENGLISH, Arrays.asList(
            new OneData("反义词：'ancient'", "modern"), // 新增题
            new OneData("'I wish I ___ (be) a bird.'正确形式填空", "were"),
            new OneData("'Cat'的复数形式是？", "cats"),
            new OneData("同义词：'happy'", "joyful"),
            new OneData("翻译：Time is money.", "时间就是金钱"),
            new OneData("'What's your name?'的礼貌回答", "My name is [姓名]"),
            new OneData("介词填空：I'm good ___ math.", "at"),
            new OneData("'He ___ (read) a book now.'正确时态填空", "is reading"),
            new OneData("'Apple'的过去式是？", "apples"),
            new OneData("连词成句：like / I / ice cream", "I like ice cream.")
    ));

    //================ 物理题库（2种） ================
    private static final ExamData physicsExam = new ExamData(UUID.randomUUID().toString(), ExamType.PHYSICS, Arrays.asList(
            new OneData("力的国际单位是？", "牛顿(N)"),
            new OneData("计算功率：做功500J用时10秒", "50W"),
            new OneData("欧姆定律公式是？", "I = U/R"),
            new OneData("光在真空中的速度是？", "3×10^8 m/s"),
            new OneData("杠杆原理公式是？", "F1×L1 = F2×L2"),
            new OneData("1标准大气压等于多少帕？", "101325 Pa"),
            new OneData("热传递的三种方式？", "传导、对流、辐射"),
            new OneData("并联电路总电阻计算公式", "1/R = 1/R1 + 1/R2 + ..."),
            new OneData("浮力定律的发现者是？", "阿基米德"),
            new OneData("动能计算公式是？", "E=½mv²")
    ));

    private static final ExamData physicsExam2 = new ExamData(UUID.randomUUID().toString(), ExamType.PHYSICS, Arrays.asList(
            new OneData("能量守恒定律的公式表达", "E₁ = E₂"), // 新增题
            new OneData("计算压强：200N作用在0.5m²面积上", "400Pa"),
            new OneData("电阻率单位是？", "欧姆·米(Ω·m)"),
            new OneData("光的折射定律中入射角与折射角的关系", "n₁sinθ₁ = n₂sinθ₂"),
            new OneData("热力学第一定律公式", "ΔU = Q - W"),
            new OneData("求电流：电压12V，电阻4Ω", "3A"),
            new OneData("计算重力加速度（h=5m，t=1s）", "约9.8m/s²"),
            new OneData("爱因斯坦质能方程", "E=mc²"),
            new OneData("波长公式（速度=频率×波长）", "λ = v/f"),
            new OneData("磁场力计算公式（F=？）", "F=qvBsinθ")
    ));

    //================ 化学题库（2种） ================
    private static final ExamData chemistryExam = new ExamData(UUID.randomUUID().toString(), ExamType.CHEMISTRY, Arrays.asList(
            new OneData("空气中含量最高的气体是？", "氮气(N₂)"),
            new OneData("配平方程式：_H₂ + O₂ → _H₂O", "2H₂ + O₂ → 2H₂O"),
            new OneData("原子核由什么组成？", "质子和中子"),
            new OneData("pH=2的溶液呈什么性？", "强酸性"),
            new OneData("金属活动性顺序表中排在氢前的金属是？", "如Fe、Zn、Cu等"),
            new OneData("二氧化碳的分子量是？", "44"),
            new OneData("实验室制氧气的常用方法？", "加热高锰酸钾"),
            new OneData("钠的原子结构示意图电子层分布是？", "2,8,1"),
            new OneData("甲烷的分子式是？", "CH₄"),
            new OneData("酸碱中和反应的产物是？", "盐和水")
    ));
    private static final ExamData chemistryExam2 = new ExamData(UUID.randomUUID().toString(), ExamType.CHEMISTRY, Arrays.asList(
            new OneData("氯气的分子式是？", "Cl₂"), // 新增题
            new OneData("计算摩尔质量：H₂SO₄", "98g/mol"),
            new OneData("酸碱指示剂酚酞在碱性溶液中的颜色", "粉红色"),
            new OneData("电解水的产物比例（H₂:O₂）", "2:1"),
            new OneData("金属铝与稀盐酸反应的方程式", "2Al + 6HCl → 2AlCl₃ + 3H₂↑"),
            new OneData("酒精的化学式是？", "C₂H₅OH"),
            new OneData("原子中质子数等于？", "原子序数"),
            new OneData("氧化还原反应的本质是？", "电子转移"),
            new OneData("催化剂在反应中的作用", "改变反应速率且不参与反应"),
            new OneData("标准状况下1mol气体体积", "22.4L")
    ));

    public static List<ExamData> chineseExamDataList = new ArrayList<>();
    public static List<ExamData> mathExamDataList = new ArrayList<>();
    public static List<ExamData> englishExamDataList = new ArrayList<>();
    public static List<ExamData> physicsExamDataList = new ArrayList<>();
    public static List<ExamData> chemistryExamDataList = new ArrayList<>();
    public static void init(){
        Collections.addAll(chineseExamDataList,chineseExam,chineseExam2);
        Collections.addAll(mathExamDataList,mathExam,mathExam2);
        Collections.addAll(englishExamDataList,englishExam,englishExam2);
        Collections.addAll(physicsExamDataList,physicsExam,physicsExam2);
        Collections.addAll(chemistryExamDataList,chemistryExam,chemistryExam2);
    }

    public static List<ExamData> getExamDataList(ExamType examType){
        if(examType.equals(ExamType.CHINESE)){
            return chineseExamDataList;
        }

        if (examType.equals(ExamType.MATH)){
            return mathExamDataList;
        }

        if (examType.equals(ExamType.ENGLISH)){
            return englishExamDataList;
        }

        if (examType.equals(ExamType.PHYSICS)){
            return physicsExamDataList;
        }

        if (examType.equals(ExamType.CHEMISTRY)){
            return chemistryExamDataList;
        }
        return null;
    }
}
